package com.alibaba.algo.dao.user;

import com.alibaba.algo.cooperation.feign.vo.req.SelectGroupPageRequestVO;
import com.alibaba.algo.cooperation.feign.vo.res.FeignEmployeeOrgInfoListVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SelectEmployeeRequestVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.EmployeeOrgResVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.EmployeeUserOrgVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.SelectUserDetailResponseVO;
import com.alibaba.algo.core.base.BaseMapper;
import com.alibaba.algo.entity.user.SysEmployeeOrg;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 类SysEmployeeOrgMapper.java的实现描述：员工和组织关联表Mapper
 *
 * @author nieganggang 2021-03-12 16:08:17
 */
public interface SysEmployeeOrgMapper extends BaseMapper<SysEmployeeOrg> {

    /**
     * 查询员工的组织列表
     *
     * @param employeeId 员工标识
     * @return 组织列表
     */
    List<EmployeeOrgResVO> selectEmployeeOrgListByEmployeeId(@Param("employeeId") Long employeeId);

    /**
     * 查询员工的组织列表
     *
     * @param employeeId 员工标识
     * @return 组织列表
     */
    List<EmployeeOrgResVO> selectEmployeeOrgListByEmployeeIdDefaultAll(@Param("employeeId") Long employeeId,@Param("isDeleted") String isDeleted);

    Integer deleteByEmployeeId(Long employeeId);

    Integer deleteByOrgId(Long orgId);

    List<Long> selectCurAndLowerUserIdList(Long orgId);

    List<Long> selectOrgIdListByCondition(
            @Param("employeeName") String employeeName,
            @Param("userAccount") String userAccount,
            @Param("employeeCode") String employeeCode,
            @Param("employeeId") Long employeeId,
            @Param("userName") String userName,
            @Param("userId") Long userId,
            @Param("searchKey") String searchKey
            );

    List<Long> selectOrgIdListByEmployeeId(@Param("employeeId") Long employeeId);

    Long selectPrimaryOrgIdListByEmployeeId(@Param("employeeId") Long employeeId);
    List<SelectUserDetailResponseVO> selectEmployeeListInOrgByName(@Param("obj") SelectEmployeeRequestVO vo);

    Integer countByOrgIdList(@Param("list") List<Long> list);

    List<EmployeeUserOrgVO> selectEmployeeOrgListByCondition(@Param("obj") SelectGroupPageRequestVO vo);

    Integer countByEmployeeIdAndOrgId(@Param("employeeId") Long employeeId, @Param("orgId") Long orgId);

    Integer deleteByEmployeeIdAndOrgId(@Param("employeeId") Long employeeId, @Param("orgId") Long orgId);

    List<FeignEmployeeOrgInfoListVO> selectPrimaryOrgInfoByEmployeeCodeList(@Param("list") List<String> employeeCodeList);

    List<FeignEmployeeOrgInfoListVO> selectPrimaryOrgInfoByEmployeeCodeListDefaultAll(@Param("isDeleted") String isDeleted, @Param("list") List<String> employeeCodeList);

    List<SysEmployeeOrg> selectListByParaStrSort(@Param("obj") SysEmployeeOrg sysEmployeeOrg, @Param("sort") String sort);

    Integer updateByEmployeeId(@Param("obj") SysEmployeeOrg sysEmployeeOrg);

    Integer updateByEmployeeIdLastModified(@Param("obj") SysEmployeeOrg sysEmployeeOrg, @Param("lastModifyTime") LocalDateTime lastModifyTime);

    Integer updateByOrgId(@Param("obj") SysEmployeeOrg sysEmployeeOrg);

    Integer updateByEmployeeIdAndOrgId(@Param("obj") SysEmployeeOrg sysEmployeeOrg);
}
